package com.upb.webserver.dao.mapper;

import com.upb.webserver.dao.entity.TbMessageRecipient;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import com.upb.webserver.dao.entity.TbMessageRecipientExample;
import java.util.List;
import java.util.Optional;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;

public interface TbMessageRecipientMapper {

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_message_recipient
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbMessageRecipientSqlProvider.class, method = "countByExample")
    long countByExample(TbMessageRecipientExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_message_recipient
     *
     * @mbg.generated
     */
    @DeleteProvider(type = TbMessageRecipientSqlProvider.class, method = "deleteByExample")
    int deleteByExample(TbMessageRecipientExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_message_recipient
     *
     * @mbg.generated
     */
    @Delete({ "delete from tb_message_recipient", "where id = #{id,jdbcType=INTEGER}" })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_message_recipient
     *
     * @mbg.generated
     */
    @Insert({ "insert into tb_message_recipient (message_id, recipient, ", "status, platform, ", "gmt_create, gmt_modified)", "values (#{messageId,jdbcType=INTEGER}, #{recipient,jdbcType=INTEGER}, ", "#{status,jdbcType=TINYINT}, #{platform,jdbcType=TINYINT}, ", "#{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP})" })
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insert(TbMessageRecipient record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_message_recipient
     *
     * @mbg.generated
     */
    @InsertProvider(type = TbMessageRecipientSqlProvider.class, method = "insertSelective")
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insertSelective(TbMessageRecipient record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_message_recipient
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbMessageRecipientSqlProvider.class, method = "selectByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "message_id", property = "messageId", jdbcType = JdbcType.INTEGER), @Result(column = "recipient", property = "recipient", jdbcType = JdbcType.INTEGER), @Result(column = "status", property = "status", jdbcType = JdbcType.TINYINT), @Result(column = "platform", property = "platform", jdbcType = JdbcType.TINYINT), @Result(column = "gmt_create", property = "gmtCreate", jdbcType = JdbcType.TIMESTAMP), @Result(column = "gmt_modified", property = "gmtModified", jdbcType = JdbcType.TIMESTAMP) })
    List<TbMessageRecipient> selectByExample(TbMessageRecipientExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_message_recipient
     *
     * @mbg.generated
     */
    @Select({ "select", "id, message_id, recipient, status, platform, gmt_create, gmt_modified", "from tb_message_recipient", "where id = #{id,jdbcType=INTEGER}" })
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "message_id", property = "messageId", jdbcType = JdbcType.INTEGER), @Result(column = "recipient", property = "recipient", jdbcType = JdbcType.INTEGER), @Result(column = "status", property = "status", jdbcType = JdbcType.TINYINT), @Result(column = "platform", property = "platform", jdbcType = JdbcType.TINYINT), @Result(column = "gmt_create", property = "gmtCreate", jdbcType = JdbcType.TIMESTAMP), @Result(column = "gmt_modified", property = "gmtModified", jdbcType = JdbcType.TIMESTAMP) })
    TbMessageRecipient selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_message_recipient
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbMessageRecipientSqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("record") TbMessageRecipient record, @Param("example") TbMessageRecipientExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_message_recipient
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbMessageRecipientSqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("record") TbMessageRecipient record, @Param("example") TbMessageRecipientExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_message_recipient
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbMessageRecipientSqlProvider.class, method = "updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(TbMessageRecipient record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_message_recipient
     *
     * @mbg.generated
     */
    @Update({ "update tb_message_recipient", "set message_id = #{messageId,jdbcType=INTEGER},", "recipient = #{recipient,jdbcType=INTEGER},", "status = #{status,jdbcType=TINYINT},", "platform = #{platform,jdbcType=TINYINT},", "gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},", "gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}", "where id = #{id,jdbcType=INTEGER}" })
    int updateByPrimaryKey(TbMessageRecipient record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_message_recipient
     *
     * @mbg.generated
     */
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert({ "<script>", "insert into tb_message_recipient (message_id, ", "recipient, status, ", "platform, gmt_create, ", "gmt_modified)", "values<foreach collection=\"list\" item=\"detail\" index=\"index\" separator=\",\">(#{detail.messageId,jdbcType=INTEGER}, ", "#{detail.recipient,jdbcType=INTEGER}, #{detail.status,jdbcType=TINYINT}, ", "#{detail.platform,jdbcType=TINYINT}, #{detail.gmtCreate,jdbcType=TIMESTAMP}, ", "#{detail.gmtModified,jdbcType=TIMESTAMP})</foreach></script>" })
    int batchInsert(List<TbMessageRecipient> list);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_message_recipient
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbMessageRecipientSqlProvider.class, method = "getOneByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "message_id", property = "messageId", jdbcType = JdbcType.INTEGER), @Result(column = "recipient", property = "recipient", jdbcType = JdbcType.INTEGER), @Result(column = "status", property = "status", jdbcType = JdbcType.TINYINT), @Result(column = "platform", property = "platform", jdbcType = JdbcType.TINYINT), @Result(column = "gmt_create", property = "gmtCreate", jdbcType = JdbcType.TIMESTAMP), @Result(column = "gmt_modified", property = "gmtModified", jdbcType = JdbcType.TIMESTAMP) })
    Optional<TbMessageRecipient> getOneByExample(TbMessageRecipientExample example);
}
